	<%! String title = "Checkout"; %>
	<%@ include file="header.jsp" %>
	<% ArrayList<Pizza> basketPizzas = sb.getPizzas();%>
	<% float totalPrice = sb.getTotalPrice(); %>
	<%! int numberOfExtraToppings = 0; %>
	<% if (request.getParameterMap().containsKey("toppings")) {
			numberOfExtraToppings = Integer.parseInt(request.getParameter("toppings"));
			totalPrice = totalPrice + ((float)numberOfExtraToppings * (float)5);
			sb.setFinalPrice(totalPrice);
	} %>

<br>
<br>	
<h3>Checkout</h3>
<br>
<b>Your basket consists of the following:</b><br>
<table>
				<% for (int i = 0; i < basketPizzas.size(); i++) {
					Pizza p = basketPizzas.get(i);
					HashMap<Integer, Integer> map = sb.getPizzaMap();
					int quantity;
					if(map.containsKey(p.getId()))
						quantity = (Integer) map.get(p.getId());
					else quantity = 1;
					
					out.print("<tr><td>" + p.toString()	+ "</td><td> Quantity: " + quantity + "</td></tr>"); 
					}
				%>
				<% if (numberOfExtraToppings > 0) {
					out.print("<tr><td>" +  "Extra toppings</td><td> Quantity: " + numberOfExtraToppings + "</td></tr>");
				} %>
</table>
<br>The total price of the pizzas is:
<% if(sb.getPizzas()!= null && sb.getPizzas().size() > 0) { out.println(totalPrice + " kr."); } //out.println(sb.getTotalPrice() + " kr."); }
else {out.println(" There is no pizzas in basket");}%>
<br>
<br>
<b>Do you wish to checkout now?</b><br>	 
	 <form method=post action=controller>
		<input type=submit name=checkout_yes value="Yes">
		<input type=submit name=checkout_no  value="No">
	</form>

</body>
</html>